<link rel="stylesheet" href="/static/css/sweetalert.css">
    <div class="content margin_top">
        <header class="header fixed_top bg_mx_green"></header>
        <div class="font_16 margin_b_10 bg_white lineheight_4 text_center flex title_nav" style="padding: 0">
            <div class="flex_1 <{if is_null($status)}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index'}>">全部</a></div>
            <div class="flex_1 <{if $status==='0'}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=0'}>">待付款</a></div>
            <div class="flex_1 <{if $status==1}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=1'}>">待发货</a></div>
            <div class="flex_1 <{if $status==2}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=2'}>">待收货</a></div>
            <div class="flex_1 <{if $status==3}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/wait-comment'}>">待评价</a></div>
            <div class="flex_1 <{if $status==5}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=5'}>">退款单</a></div>
        </div>
        <div class="order_list"></div>
    </div>

    <script src="/static/js/sweetalert-dev.js"></script>
    <script type="text/template" charset="utf-8" id='order_template'></script>
    <script>
        // 页面初始化
            var order_list = <{$orderlist}>;console.log(order_list);
            loadorder(order_list);
            loadheadbar("订单管理");
        // 取消订单
            function quit_order(n){
                $.post("/business/user/pork-order/cancal",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
                    swal({
                            title: res.msg,
                            text: "",
                            type: "success",
                            showCancelButton: false,
                            confirmButtonColor: "#DD6B55",
                            confirmButtonText: "确定",
                            closeOnConfirm: true
                        },
                        function(resault){
                            if(resault && res.status==0){
                                window.location.reload();
                            }
                        });
                },"json")
            }
        // 支付
            function pay_order(n){
//                $.post("",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
//
//                },"json")
                  location.href='/pay/wechat/pay/index?oid='+n;
            }
        // 确认收货
            function confirm_order(n){
                $.post("/business/user/pork-order/receive",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
                    swal({
                        title: res.msg,
                        text: "",
                        type: "success",
                        showCancelButton: false,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "确定",
                        closeOnConfirm: true
                    },
                    function(resault){
                        if(resault && res.status==0){
                            window.location.href='/business/user/pork-order/wait-comment';
                        }
                    });
                },"json")
            }
        // 评价
            function comment_order(n,oid){
                 location.href = "/shop/goods/comment?id="+n+'&oid='+oid;
            }

            function refund_order(n){
                $.post("/business/user/pork-order/refund",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
                    // alert(res.msg);
                    swal({
                        title: res.msg,
                        text: "",
                        type: "success",
                        showCancelButton: false,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "确定",
                        closeOnConfirm: true
                    },
                    function(resault){
                        if(resault && res.status==0){
                            window.location.reload()
                        }
                    });
                },"json")
            }
    </script>


